package icu.javayanglei.bilibili.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 视频详情表
 *
 * @TableName video
 */
@TableName(value = "video")
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@Slf4j
public class Video implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    /**
     * id
     */
    @TableId(value = "id")
    private Long id;
    /**
     * cid 根据 cid 获取弹幕
     */
    @TableField(value = "cid")
    private String cid;
    /**
     * 稿件封面图片url
     */
    @TableField(value = "pic")
    private String pic;
    /**
     * 稿件标题
     */
    @TableField(value = "title")
    private String title;
    /**
     * 稿件发布时间 时间戳
     */
    @TableField(value = "pubdate")
    private LocalDateTime pubdate;
    /**
     * 用户投稿时间
     */
    @TableField(value = "ctime")
    private LocalDateTime ctime;
    /**
     * 视频简介
     */
    @TableField(value = "`desc`")
    private String desc;
    /**
     * 播放数
     */
    @TableField(value = "view")
    private Long view;
    /**
     * 弹幕数
     */
    @TableField(value = "danmaku")
    private Long danmaku;
    /**
     * 评论数
     */
    @TableField(value = "reply")
    private Long reply;
    /**
     * 收藏数
     */
    @TableField(value = "favorite")
    private Long favorite;
    /**
     * 投币数
     */
    @TableField(value = "coin")
    private Long coin;
    /**
     * 分享数
     */
    @TableField(value = "share")
    private Long share;
    /**
     * 获赞数
     */
    @TableField(value = "`like`")
    private Long like;
    /**
     * 点踩数
     */
    @TableField(value = "dislike")
    private Long dislike;
    /**
     * bv id
     */
    @TableField(value = "bvid")
    private String bvid;
    /**
     * 作者 uid
     */
    @TableField(value = "mid")
    private String mid;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Video other = (Video) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getCid() == null ? other.getCid() == null : this.getCid().equals(other.getCid()))
                && (this.getPic() == null ? other.getPic() == null : this.getPic().equals(other.getPic()))
                && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
                && (this.getPubdate() == null ? other.getPubdate() == null : this.getPubdate().equals(other.getPubdate()))
                && (this.getCtime() == null ? other.getCtime() == null : this.getCtime().equals(other.getCtime()))
                && (this.getDesc() == null ? other.getDesc() == null : this.getDesc().equals(other.getDesc()))
                && (this.getView() == null ? other.getView() == null : this.getView().equals(other.getView()))
                && (this.getDanmaku() == null ? other.getDanmaku() == null : this.getDanmaku().equals(other.getDanmaku()))
                && (this.getReply() == null ? other.getReply() == null : this.getReply().equals(other.getReply()))
                && (this.getFavorite() == null ? other.getFavorite() == null : this.getFavorite().equals(other.getFavorite()))
                && (this.getCoin() == null ? other.getCoin() == null : this.getCoin().equals(other.getCoin()))
                && (this.getShare() == null ? other.getShare() == null : this.getShare().equals(other.getShare()))
                && (this.getLike() == null ? other.getLike() == null : this.getLike().equals(other.getLike()))
                && (this.getDislike() == null ? other.getDislike() == null : this.getDislike().equals(other.getDislike()))
                && (this.getBvid() == null ? other.getBvid() == null : this.getBvid().equals(other.getBvid()))
                && (this.getMid() == null ? other.getMid() == null : this.getMid().equals(other.getMid()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCid() == null) ? 0 : getCid().hashCode());
        result = prime * result + ((getPic() == null) ? 0 : getPic().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getPubdate() == null) ? 0 : getPubdate().hashCode());
        result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode());
        result = prime * result + ((getDesc() == null) ? 0 : getDesc().hashCode());
        result = prime * result + ((getView() == null) ? 0 : getView().hashCode());
        result = prime * result + ((getDanmaku() == null) ? 0 : getDanmaku().hashCode());
        result = prime * result + ((getReply() == null) ? 0 : getReply().hashCode());
        result = prime * result + ((getFavorite() == null) ? 0 : getFavorite().hashCode());
        result = prime * result + ((getCoin() == null) ? 0 : getCoin().hashCode());
        result = prime * result + ((getShare() == null) ? 0 : getShare().hashCode());
        result = prime * result + ((getLike() == null) ? 0 : getLike().hashCode());
        result = prime * result + ((getDislike() == null) ? 0 : getDislike().hashCode());
        result = prime * result + ((getBvid() == null) ? 0 : getBvid().hashCode());
        result = prime * result + ((getMid() == null) ? 0 : getMid().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", cid=").append(cid);
        sb.append(", pic=").append(pic);
        sb.append(", title=").append(title);
        sb.append(", pubdate=").append(pubdate);
        sb.append(", ctime=").append(ctime);
        sb.append(", desc=").append(desc);
        sb.append(", view=").append(view);
        sb.append(", danmaku=").append(danmaku);
        sb.append(", reply=").append(reply);
        sb.append(", favorite=").append(favorite);
        sb.append(", coin=").append(coin);
        sb.append(", share=").append(share);
        sb.append(", like=").append(like);
        sb.append(", dislike=").append(dislike);
        sb.append(", bvid=").append(bvid);
        sb.append(", mid=").append(mid);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
